﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyMainIndexControl.ascx.cs" Inherits="UserControl_MyMainIndexControl" %>
<style type="text/css">
    .style3
    {
    }
    .style4
    {
        width: 100%;
    }
</style>
 <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:RAOVATConnectionString %>" 
        
        SelectCommand="SELECT TenTinRaoVat, MaTinRaoVat, Thumbnail FROM TIN_RAO_VAT WHERE (Thumbnail IS NOT NULL) AND (Deleted = 0) ORDER BY ThoiGianDang DESC">
    </asp:SqlDataSource>

<table style="width:550px; height: 450px;">
<tr>
<td width="300" class="style3" valign="top">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
             <asp:Timer ID="Timer1" runat="server" Interval="2000" ontick="Timer1_Tick">
            </asp:Timer>
            <asp:FormView ID="FormView1" runat="server" DataKeyNames="MaTinRaoVat" 
                Height="450px" AllowPaging="True" >
                <EditItemTemplate>
                   
                    <asp:Label ID="MaTinRaoVatLabel1" runat="server" 
                        Text='<%# Eval("MaTinRaoVat") %>' />
                    <br />
                 
                    <asp:TextBox ID="NoiDungTinRaoVatTextBox" runat="server" 
                        Text='<%# Bind("NoiDungTinRaoVat") %>' />
                    <br />
                   
                    <asp:TextBox ID="TenTinRaoVatTextBox" runat="server" 
                        Text='<%# Bind("TenTinRaoVat") %>' />
                    <br />
                    <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Update" />
                    &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </EditItemTemplate>
                <InsertItemTemplate>
                    NoiDungTinRaoVat:
                    <asp:TextBox ID="NoiDungTinRaoVatTextBox" runat="server" 
                        Text='<%# Bind("NoiDungTinRaoVat") %>' />
                    <br />
                    TenTinRaoVat:
                    <asp:TextBox ID="TenTinRaoVatTextBox" runat="server" 
                        Text='<%# Bind("TenTinRaoVat") %>' />
                    <br />
                    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Insert" />
                    &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </InsertItemTemplate>
                <ItemTemplate>
                    &nbsp;<table class="style4" cellpadding="0" cellspacing="0" valign="top">
                        <tr>
                            <td valign="top">
                                <asp:Image ID="Image2" runat="server" Height="300px" 
                                    ImageUrl='<%# Eval("MaTinRaoVat", "~/ShowImage.aspx?id={0}") %>' 
                                    Width="300px" />
                                <br />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox ID="TenTinRaoVatLabel" runat="server" 
                                    Text='<%# Bind("TenTinRaoVat") %>' Height="49px" MaxLength="100" 
                                    ReadOnly="True" Width="296px" Rows="3" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:TextBox ID="NoiDungTinRaoVatLabel" runat="server" BorderWidth="0px" 
                                    Enabled="False" Height="72px" MaxLength="20" Rows="4" 
                                    Text='<%# Bind("NoiDungTinRaoVat") %>' TextMode="MultiLine" Width="290px" 
                                    EnableViewState="False" />
                            </td>
                        </tr>
                    </table>
                    <br />
                </ItemTemplate>
            </asp:FormView>
            <br />
           
        </ContentTemplate>
    </asp:UpdatePanel>
    </td>
<td valign="top">
    <asp:GridView ID="GridView1" runat="server" Height="400px" Width="240px" 
        AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="MaTinRaoVat" 
        PageSize="5" ShowHeader="False" 
        GridLines="None">
        <PagerSettings PageButtonCount="1" Visible="False" />
        <Columns>
            <asp:TemplateField HeaderText="Hình Ảnh">
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" Height="80px" 
                        ImageUrl='<%# Eval("MaTinRaoVat", "~/RaoVat/ShowImage.aspx?id={0}") %>' 
                        Width="80px" />
                </ItemTemplate>
                <ItemStyle Width="80px" />
            </asp:TemplateField>
            <asp:TemplateField HeaderText="TenTinRaoVat" SortExpression="TenTinRaoVat">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" 
                        NavigateUrl='<%# Eval("MaTinRaoVat", "~/RaoVat/ChiTietTinRaoVat.aspx?ID={0}") %>'  Text='<%# Bind("TenTinRaoVat") %>'></asp:HyperLink>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TenTinRaoVat") %>'></asp:TextBox>
                </EditItemTemplate>
            </asp:TemplateField>
       
        </Columns>
    </asp:GridView>
   
    </td>
</tr>
</table>
 


 
